<!--
 @Author: libing/makeup1122
 @Email: makeup1123@163.com
 @Date: "2020-04-04 15:41:28"
-->
<template>
  <v-switch
    v-bind="$attrs"
    :input-value="value"
    @change="inputHandle"
    color="orange"
    true-value="allow"
    false-value="disallow"
    :label="'评论：' + (value === 'allow' ? '打开' : '关闭')"
  ></v-switch>
</template>
<script>
export default {
  name: 'CommentSwitch',
  props: {
    value: {
      type: String,
      default: 'disallow',
      validator: function (value) {
        // 这个值必须匹配下列字符串中的一个
        return ['allow', 'disallow'].indexOf(value) !== -1
      }
    }
  },
  components: {},
  data: function () {
    return {
    }
  },
  computed: {},
  created: function () {
  },
  methods: {
    inputHandle: function(val) {
      this.$emit('input', val)
    }
  }
}
</script>
<style scoped>
</style>
